package com.example.myspringbootdemojava1.domain;

import lombok.Data;

/**
 * @author 黑马程序员
 */
@Data
public class Result<T> {

    private Integer code;
    private T data;
    private String msg;

    //处理返回成功结果
    public static <T> Result success(Integer code,T data){
        Result result = new Result<>();
        result.setCode(code);
        result.setData(data);
        return result;
    }

    //处理返回成功结果
    public static <T> Result error(Integer code,T data,String msg){
        Result result = new Result<>();
        result.setCode(code);
        result.setData(data);
        result.setMsg(msg);
        return result;
    }
}
